import { createStore, applyMiddleware } from "redux";
import { rootReducer } from "./reducers";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import { getToken } from "@/utils";

// 为了在刷新页面的时候，能够让redux能拿到token值，可以为createStore 指定默认值参数
const initialState = {
  // login:localStorage.getItem('geek-token')
  login: getToken(),
};

// 创建store
const store = createStore(rootReducer, initialState, composeWithDevTools(applyMiddleware(thunk)));
export default store;
